require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
platform :ios, '15.1'
source 'https://github.com/CocoaPods/Specs.git'
#use_modular_headers!

# Disable VisionCamera location API usage
$VCEnableLocation = false

pod 'Firebase', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'FirebaseRemoteConfig', :modular_headers => true
pod 'FirebaseABTesting', :modular_headers => true
pod 'FirebaseCoreExtension', :modular_headers => true
pod 'FirebaseInstallations', :modular_headers => true
pod 'GoogleDataTransport', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
pod 'nanopb', :modular_headers => true

install! 'cocoapods', :deterministic_uuids => false
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

prepare_react_native_project!

# Prevent Cocoapods from collecting stats, which adds time to each pod installation
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

target 'PriceWidgetExtension' do
  pod 'swift-vibrant'
end

target 'SelectTokenIntent' do
  pod 'swift-vibrant'
end

target 'ImageNotification' do
  pod 'Firebase/Messaging', :modular_headers => true
end

target 'Rainbow' do

  use_expo_modules!
  post_integrate do |installer|
    begin
      expo_patch_react_imports!(installer)
    rescue => e
      Pod::UI.warn e
    end
    begin
      expo_patch_react_imports!(installer)
    rescue => e
      Pod::UI.warn e
    end
  end
  # Pods for Rainbow
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    privacy_file_aggregation_enabled: false,
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => ENV['USE_HERMES'] != 'NO',
    :new_arch_enabled => false,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
  pod 'swift-vibrant'

  # Rainbow's Internal Modules.
  pod 'Rainbow-Internals', :path => './Internals'

  pod 'FLAnimatedImage'
  pod 'libwebp'
  pod 'RNInputMask', :path => '../node_modules/react-native-text-input-mask/ios/InputMask'

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'Permission-FaceID', :path => "#{permissions_path}/FaceID"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
  pod "PanModal", :git => 'https://github.com/rainbow-me/PanModal', :commit => 'ab97d74279ba28c2891b47a5dc767ed4dd7cf994'
  pod 'Shimmer'
  pod 'SRSRadialGradient', :path => '../node_modules/react-native-radial-gradient/ios'
  pod 'react-native-palette-full', :path => '../node_modules/react-native-palette-full'
  pod 'react-native-ble-plx', :path => '../node_modules/react-native-ble-plx'
  pod 'TOCropViewController', '~> 2.7.4'

  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false,
      # :ccache_enabled => true
    )
    # This is necessary for Xcode 14, because it signs resource bundles by default when building for devices.
    installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
      target_installation_result.resource_bundle_targets.each do |resource_bundle_target|
        resource_bundle_target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
        end
      end
    end
  end
end
